﻿@using KMF.Common
@using KMF.WebUI.Areas.KMFadmin.CustomHelpers
@using KMF.WebUI.Areas.KMFadmin.Models
@model IEnumerable<NewsCategoryListAdminDto>
@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/KMFadmin/Views/Shared/_layout.cshtml";
    var ListChildCate = (List<NewsCategoryListAdminDto>)ViewBag.ListChildCate;

}

<nav>
    <div id="jCrumbs" class="breadCrumb module">
        <ul>
            <li><a href="@Url.Action("Index", "AdminHome")"><i class="bootstrap icon-home"></i></a></li>
            <li><a href="javascript:void(0)">Các danh mục tin</a> </li>
        </ul>
    </div>
</nav>

<div class="toolBox">
    @Html.ToolBox(new List<object> { new Add { ClassCss = "Add", ActionName = "/KMFadmin/AdminNewsCategory/AddNewsCategory" } })
</div>
@*<div class="box-search">
        <div class="fl-l"></div>
        @using (Html.BeginForm("SearchBanner", "Banner"))
        {
            @Html.TextBox("keyword")
            <input type="submit" value="Tìm kiếm" />
        }
        <div class="fl-r"></div>
        <div class="clear"></div>
    </div>*@
<div style="overflow:hidden;">
    <table class="table-odd" cellspacing="0" cellpadding="0">
        <colgroup>
            <col />
            <col style="width: 30px" />
            <col />
            <col style="width: 80px" />
            <col style="width: 50px" />
            <col style="width: 50px" />
            <col style="width: 70px" />
        </colgroup>
        <thead>
            <tr>
                <th style="width: 35px; text-align: center; padding-left: 0;">@Html.CheckBox("chkAll")</th>
                <th scope="col">STT</th>
                <th scope="col">Tên danh mục</th>
                <th scope="col">Thứ tự</th>
                <th scope="col">Loại</th>
                <th scope="col">Hiển thị</th>
                <th></th>
            </tr>
        </thead>
        @foreach (var item in Model)
        {
        <tr class="@string.Format("bn-{0}", item.Id) trHeight">
            <td class="bgTableFirst">
                @Html.CheckBox("chkItem")
            </td>
            <td>@item.STT</td>
            <td style="text-align: left;">
                <a href="@Url.Action("EditNewsCategory", "AdminNewsCategory", new { ID = item.Id })" title="@item.CateName">@item.CateName</a>
                <div class="info-ad-qv">
                    <a href="@Url.Action("EditNewsCategory", "AdminNewsCategory", new { id = @item.Id })">Sửa</a> |
                    <a href="">Sửa nhanh</a> |
                    @Ajax.ActionLink("Xóa", "DeleteNewsCategory", "AdminNewsCategory", new { id = item.Id }, new AjaxOptions
                                                                                                       {
                                                                                                           Confirm = "Bạn chắc chắn muốn xóa danh mục này!",
                                                                                                           OnSuccess = "AjaxReturnDataDelNewsCategory"
                                                                                                       }, new { @class = "icon-del2 ad-qv-txt2" }) |
                    <a href="">Xem</a>
                </div>
            </td>
            <td>
                @item.Ordering
            </td>
            <td>
                @item.Type
            </td>
            <td>
                <input type="checkbox" id="@item.Id" @string.Format("{0}", item.Active ? "checked" : "") />
            </td>
            <td align="center">
                @Ajax.ActionLink("Xóa", "DeleteNewsCategory", "AdminNewsCategory", new { id = item.Id }, new AjaxOptions
                                                                                                       {
                                                                                                           Confirm = "Bạn chắc chắn muốn xóa danh mục này!",
                                                                                                           OnSuccess = "AjaxReturnDataDelNewsCategory"
                                                                                                       }, new { @class = "icon-delete bootstrapTangoSmall", title = "chỉnh sửa" })
            </td>
        </tr>
        }
    </table>
</div>
<div class="p-paging">
    @Html.PageLinks((PageInfo)ViewBag.PageInfo, i => Url.Action("Index", "AdminNewsCategory", new { page = i }))
</div>

@section scripts
{
    <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
    <script type="text/javascript">
        function AjaxReturnDataDelNewsCategory(data) {
            if (data) {
                window.location = document.URL;
            }
        }
    </script>
}


